package com.xnyzc.lhy.common.penum.oss;

/**
 * OSS 文件类型
 */
public enum OSSFileType {

    cuser("1","images/drive/"),
    duser("2", "images/drive/"),
    muser("3", "images/drive/"),
    vehicle("4", "images/drive/"),
    identity("5","images/drive/"),
    apk("6","apk/"),
    other("7","other/"),
    mp3("8","audiorecord/");

    private String type;
    private String value;

    OSSFileType(String type, String value){
        this.type = type;
        this.value = value;
    }


    public static OSSFileType findByPath(String type){
        OSSFileType oSSFileType;
        switch (type){
            case "1":
                oSSFileType  = OSSFileType.cuser;
                break;
            case "2":
                oSSFileType = OSSFileType.duser;
                break;
            case "3":
                oSSFileType = OSSFileType.muser;
                break;
            case "4":
                oSSFileType = OSSFileType.vehicle;
                break;
            case "5":
                oSSFileType = OSSFileType.identity;
                break;
            case "6":
                oSSFileType = OSSFileType.apk;
                break;
            case "7":
                oSSFileType = OSSFileType.other;
                break;
            case "8":
                oSSFileType = OSSFileType.mp3;
                break;
            default:
                throw new IllegalArgumentException("非法type");
        }
        return oSSFileType;
    }

    public String getValue() {
        return this.value;
    }
}
